/*
 * $Id: GarbageFreeLongFormatter.java 66 2013-01-06 10:16:51Z vladimirow@mail.ru $
 * $HeadURL: http://ultralog.googlecode.com/svn/ultralog/tags/release-0.1/src/java/com/google/code/ultralog/formatter/gfree/GarbageFreeLongFormatter.java $
 *
 * This file is a part of ultralog project (http://code.google.com/p/ultralog/).
 * Released under New BSD License.
 */
package com.google.code.ultralog.formatter.gfree;

import com.google.code.ultralog.formatter.LongFormatter;
import com.google.code.ultralog.utils.CharacterOutputStream;

/**
 * Garbage free implementation of {@link LongFormatter} interface.
 *
 * @author Mikhail Vladimirov
 */
public class GarbageFreeLongFormatter implements LongFormatter
{
    /**
     * Singleton instance of the formatter.
     */
    public final static GarbageFreeLongFormatter INSTANCE =
        new GarbageFreeLongFormatter ();

    private GarbageFreeLongFormatter ()
    {
        // Do nothing
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void format (long value, CharacterOutputStream output)
    {
        if (output == null)
            throw new IllegalArgumentException ("Output is null");

        GarbageFreeFormatterUtils.writeLong (value, output);
    }
}
